package projet.service;

import java.util.Date;
import java.util.List;

import projet.dao.CourseDAOInterface;
import projet.dao.DAOFactoryInterface;
import projet.dao.LocationDAOInterface;
import projet.entity.Course;
import projet.entity.Location;

public class HomeService {
	
	public List<Course> getCourses() {
		DAOFactoryInterface daoFactory = DAOUtil.getDAOFactory();
		CourseDAOInterface courseDAO = daoFactory.getCourseDAO();
		
		List<Course> courses = courseDAO.getList();
		return courses;
	}
	
	public List<Location> getLocations() {
		DAOFactoryInterface daoFactory = DAOUtil.getDAOFactory();
		LocationDAOInterface locationDAO = daoFactory.getLocationDAO();
		
		List<Location> locations = locationDAO.getList();
		return locations;
	}

	public List<Course> getCoursesByCriteria(String keyword, Long locationId, Date date) {
		DAOFactoryInterface daoFactory = DAOUtil.getDAOFactory();
		CourseDAOInterface courseDAO = daoFactory.getCourseDAO();
		
		return courseDAO.getListByCriteria(keyword, locationId, date);
	}

}
